Move signup to backend and restrict

I am using advanced template, and I want to put the signup process into the backend and restrict it to based on User logged in - ie, i want admin users to be able to create new users.

So in moving all the signup components - site/signup, models/SignupForm, it is saying “You are not allowed to perform this action”. Is this because only guests are allowed ? I can’t see where the controller restricts this access.

Is what i’m trying to achieve possible, using the /frontend template, or is it not built that way ?

Ie, for admin, to be able to create new users - while they are logged in themselves.

thx

HI u can set the rules in Sitecontroller , behavior function




public function behaviors()

    {

        return [

            'access' => [

                'class' => AccessControl::className(),

                'only' => ['logout', 'signup'],

                'rules' => [

                  

                    [

                        'actions' => ['logout'],

                        'allow' => true,

                        'roles' => ['@'],

                    ],

                ],

            ],

            'verbs' => [

                'class' => VerbFilter::className(),

                'actions' => [

                    'logout' => ['post'],

                ],

            ],

        ];

    }




@ are registered user …

Copy the controller actions, model, and views from the froontend to the backend.

You should also delete the actions in the frontend site controller . The actions are login, logout, register/signup etc… By doing that there is no possible way for anyone to sign up someone via the front end and there is no need for your 403 message you want to put. If someone would to go to site/login it would be a 404 error page not found because the action doesn’t exsist anymore.

1 Like

Hi. I havve the same idea. I moved the signup process to the backend. The signup works, but how can I add propertys to the Model (Same as SignUp-Model from frontend). I added the property but the value doesnt get set.