6

The Guest Entries plugin is made for this scenario!


5

If you want to restrict the whole API, you can add some code to the top of your /config/elementapi.php file (right below namespace Craft;) that checks for a logged in user, and ends the request with an appropriate status if the user isn't logged in: <?php namespace Craft; $user = craft()->userSession->getUser(); if (!$user) { HeaderHelper::...


4

You're correct about both beforeAction() and onBeginRequest(). However, you could put an init() method in your main plugin class file and this will execute on every request as long as the plugin is installed and enabled. public function init() { // Whatever code you were going to put in onBeginRequest can go here. parent::init(); }


4

The basic user identity relies on login and password, so you will have to create your own class to represent an identity based on something else, like a token for example: <?php namespace Craft; class TokenIdentity extends UserIdentity { private $_id; public $token; public function __construct($token) { $this->token = $token;...


3

I created a react native app with Craft CMS (still version 2.6) as backend using the Element API. But you're right, user authentication is not supported by the Element API. However, I created my own plugin to get user authenticated. I even create user and update their details through the app. But storing user sessions in React Native is another story. That ...


3

I have built something similar so hopefully this will help get you rolling. You are going to need to (or at least I would) create a plugin that you can call in your twig template. Pay special attention about creating a variable and services. Let's say your plugin is called theater. Let's also pretend you have a url "mysite.com/showtimes" In your showtimes ...


3

Sounds like a custom plugin is in order. Your plugin could add a custom {% validateUser %} Twig tag. That tag would check to see if their logged in OR check craft.request.getIpAddress() and validate against your internal IP whitelist for your company. You should read the notes on that link, though, since this isn't guaranteed to be secure. It's trivial to ...


3

Is the physical web server inside your network as well? As mcclaskiem mentioned, check to see if the IP address is within the subnet of your network and then allow access that way. You may want to have the web server listen on another hostname that's not accessible outside the network and allow access to that vhost unconditionally (but do that at the ...


3

You're basically looking for authentication/authorization for the Element API plugin, which it currently doesn't support. Should this require us to write our own plugin with a custom authentication system or is it possible to get this working with the user logic provided by Craft? I'd probably approach this by forking the Element API plugin and adding ...


3

Craft does some basic logging in the form of when an entry was updated/created and the last time a user logged in and from what IP address, etc. If you want anything more detailed than that, you'd need a plugin. There is one called Audit Log that might do what you're looking for.


2

For 2, which is indeed subjective but nevertheless: Coming from WordPress, I always tell my customers that Craft is way better for us because I don't have to strip down a CMS before starting a project. WordPress did a lot of things without us even knowing about it. With Craft, I start with a blank sheet and work my way up, knowing exactly why things work the ...


2

For 1), check out Dukt's oAuth plugin for Craft. Not aware of any Active Directory plugins that have been written yet and not seeing any on here, either. The second question is pretty subjective, so not sure if that's the best type of question for SE, but I'll let someone else take a stab at it if they want.


2

Seems totally doable with a plugin. The protected page where they enter their email address would post to a controller action in your plugin. Your controller checks the domain of the submitted email, verifies it's from acme.com then generates a token (maybe using StringHelper::UUID() or craft()->security->generateRandomString() if it should be ...


2

You could loop through the users and compare them. {% set authorized = false %} {% for user in entry.authorizedUsers %} {% if user == currentUser %} {% set authorized = true %} {% endif %} {% endfor %} {% if not authorized %} {% redirect 403 %} {% endif %}


2

First set your web server up so the full website gets loaded from both the external ports (e.g. 80 and 443) as well as your internal port (let's say 9001). Then open your index.php file, and add this to the top of it: // Restrict CP access to port 9001 if ( $_SERVER['SERVER_PORT'] != 9001 && isset($_GET['p']) && preg_match('^\/*...


2

From experience, in terms of ui/ux AND ease in front end stages, If you can do things the other way round, do that. So attached entries to users basically. When you have a new user, you add entries in one place vs adding the user on every single entries which, if you have loads of could turn into a bit of a mission.. You'll find this way round easier to ...


2

TL/DR It sounds like you need to enable sticky sessions at your load-balancer/router level, so that the users will be sent back to the same server in the cluster that their session originated on. The long version In Craft 2.x, every new user gets new PHP session represented by a file on your web server and a cookie in your browser. By default PHP names ...


2

What about setting up a relation between your CustomUserAuthModel and the UserModel, check if everything is alright through your plugin with IndieAuth, and then login, through UserSessionService->impersonate()? The new user session will only last as long as the browser session remains active; no identity cookie will be * created. Not sure if that will work ...


2

I know this is a little late, but i've just build a plugin for TOTP. It is in beta, so beware before using it in a production environment. https://github.com/born05/craft-twofactorauthentication


2

Craft Pro gives you the ability to add multiple user accounts to your site. Craft Commerce is a plugin that extends Craft so user accounts and everything that goes with them are available to use. There is a plugin to enable social logins (currently in beta) made by Dukt that you may find helpful.


2

Thank you for pointing me in the right direction! That was super helpful. Here's what I ended with so far. Things may change depending on what I need down the road. It uses Basic Auth like I mentioned in the original post. The main thing I wanted was to be able to pass the URL as a parameter so I could use the same function to get various data. I created a ...


2

It sounds like you just want a cron job to trigger an action on your plugin. You don't need to register any Control Panel routes for that, so you can remove your registerCpRoutes method. If your plugin only has one controller, the URL your cron job would want to target would be: yoursite.com/actions/pluginHandle/pluginAction You can read more about it in ...


2

There's a feature request here that would allow custom login forms for the Craft Control Panel login page you might want to add a comment to. In the meantime, there is a userSession.onBeforeAuthenticate event a plugin can listen to to perform any 3rd party authentication. You can see how a similar plugin did this for front-end LDAP logins here: https://...


2

You are going to have a hard time if you want to use Yii2 with Craft 2 since they are totally incompatible. Craft 2 uses yii and Craft 3 uses Yii2. You can't mix them. Furthermore you'll need multiple custom changes when you want to drop the native Craft user registration and replace it with Yii2 (less powerful) user registration. (what's wrong about Crafts ...


1

Craft Commerce and Craft does not support that service out of the box. A Craft plugin would need to created using their PHP Package: https://github.com/auth0/auth0-PHP


1

In more testing, I was able to eliminate the "Can't bind to LDAP server!" error message from Craft by removing both: Account Suffix and Admin Account Suffix settings from the ADLDAP parameter control panel. In my particular setup, I left all parameters empty in the 'optional' section of the parameter control panel, with the exception of the port ('389') and '...


1

You didn't mention in the post, but you tagged the question with Dukt oAuth. If you're trying to connect with that, Channel Advisor isn't a 1st or 3rd party Dukt oAuth provider. You can see a list of the available ones here: https://dukt.net/oauth/providers You'd need to right an oAuth Channel Advisor Craft plugin in order for it to work.


1

A possible workaround would be to use the phone numbers as the username. Then you could write a Craft plugin that listened to the onBeforeLogin event and validated the entered phonenumber against your custom field and proceeded accordingly.


1

The short answer is no. Craft does not natively support this, and there's no way to implement it via a hook (or event). A quick browse through the code shows that the UserIdentity::authenticate method is where most of the action takes place (called from the UserSessionService::login method), and that's very much tied to using either a username or an email ...


1

If the cron jobs are triggered at the server where your Craft installation is hosted, it might be better to implement a consolecommand instead to execute the logic you want. They are well suited for that. With a console command your crontab entry would look like: */1 * * * * php /opt/craft-app/current/craft/app/etc/console/yiic PLUGINNAME ACTIONNAME ...


Only top voted, non community-wiki answers of a minimum length are eligible