function _social_user_pass_reset_submit in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 8.2 modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 8.3 modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 8.4 modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 8.5 modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 8.6 modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 8.7 modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 8.8 modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 10.3.x modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 10.0.x modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 10.1.x modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
- 10.2.x modules/social_features/social_user/social_user.module \_social_user_pass_reset_submit()
Submit function for resetting password form.
1 string reference to '_social_user_pass_reset_submit'
- social_user_form_user_form_alter in modules/
social_features/ social_user/ social_user.module - Implements hook_form_FORM_ID_alter().
File
- modules/
social_features/ social_user/ social_user.module, line 122 - The social user module alterations.
Code
function _social_user_pass_reset_submit($form, FormStateInterface $form_state) {
$storage = $form_state
->getValues();
$submitted_user_id = isset($storage['uid']) ? $storage['uid'] : '';
// Only when there is actual user, and the actual user is changing his own
// account we redirect. When you're editing others you don't want this.
if (!empty($submitted_user_id) && \Drupal::currentUser()
->id() == $submitted_user_id) {
$first_time_login = $form_state
->get('first_time_login');
// If created & changed user time are the same, the user has never submitted
// the user save form before. Which means we can redirect to user profile.
if ($first_time_login) {
$form_state
->setRedirect('entity.profile.type.user_profile_form', [
'user' => $submitted_user_id,
'profile_type' => 'profile',
[],
]);
$form_state
->set('first_time_login', FALSE);
}
else {
// We redirect them to the home page stream.
$form_state
->setRedirect('social_core.homepage');
}
}
}