Skip to content
Permalink
Browse files

Fixed some bugs with connecting.

Conflicts:

	applications/dashboard/js/entry.js
  • Loading branch information
tburry committed Nov 7, 2011
1 parent e3d7ec1 commit c6fbc330c9694907fe95b5ee90e1d0691b16860d
@@ -338,8 +338,15 @@ public function Connect($Method) {
// The user is already connected.
$this->Form->SetFormValue('UserID', $UserID);
$User = Gdn::UserModel()->GetID($UserID, DATASET_TYPE_ARRAY);
$Data = $this->Form->FormValues();
// Don't overwrite the user photo if the user uploaded a new one.
$Photo = GetValue('Photo', $User);
if (GetValue('Photo', $Data) && $Photo && !StringBeginsWith($Photo, 'http')) {
unset($Data['Photo']);
}
// Synchronize the user's data.
$UserModel->Save($Data, array('NoConfirmEmail' => TRUE));
@@ -399,7 +406,7 @@ public function Connect($Method) {
$ExistingUsers);
}
if (!isset($NameFound)) {
if (!isset($NameFound) && !$IsPostBack) {
$this->Form->SetFormValue('ConnectName', $this->Form->GetFormValue('Name'));
}
@@ -500,7 +507,7 @@ public function Connect($Method) {
$User['Password'] = RandomString(50); // some password is required
$User['HashMethod'] = 'Random';
$UserID = $UserModel->Register($User, array('CheckCaptcha' => FALSE));
$UserID = $UserModel->Register($User, array('CheckCaptcha' => FALSE), array('NoConfirmEmail' => TRUE));
$User['UserID'] = $UserID;
$this->Form->SetValidationResults($UserModel->ValidationResults());
@@ -1,7 +1,7 @@
// This file contains javascript that is specific to the dashboard/entry controller.
jQuery(document).ready(function($) {
// Check to see if the selected email is valid
$('#Register input[name=$Email], body.register input[name$=Email]').blur(function() {
$('#Register input[name$=Email], body.register input[name$=Email]').blur(function() {
var email = $(this).val();
if (email != '') {
var checkUrl = gdn.url('/dashboard/user/emailavailable/'+encodeURIComponent(email)+'/x');
@@ -170,5 +170,6 @@ function Plural($Number, $Singular, $Plural) {
$Definition['Warning: This is for advanced users.'] = '<b>Warning</b>: This is for advanced users and requires that you make additional changes to your web server. This is usually only available if you have dedicated or vps hosting. Do not attempt this if you do not know what you are doing.';
$Definition['Activity.Delete'] = '×';
$Definition['Draft.Delete'] = '×';
$Definition['ConnectName'] = 'Username';
// TODO: PROVIDE TRANSLATIONS FOR ALL CONFIGURATION SETTINGS THAT ARE EDITABLE ON ADMIN FORMS (ie. Vanilla.Comments.MaxLength, etc).
@@ -823,17 +823,23 @@ public function Save($FormPostValues, $Settings = FALSE) {
if (isset($Fields['Email']) && $UserID == Gdn::Session()->UserID && $Fields['Email'] != Gdn::Session()->User->Email && !Gdn::Session()->CheckPermission('Garden.Users.Edit')) {
$User = Gdn::Session()->User;
$Attributes = Gdn::Session()->User->Attributes;
$EmailKey = TouchValue('EmailKey', $Attributes, RandomString(8));
$ConfirmEmailRoleID = C('Garden.Registration.ConfirmEmailRole');
if (RoleModel::Roles($ConfirmEmailRoleID)) {
// The confirm email role is set and it exists so go ahead with the email confirmation.
$EmailKey = TouchValue('EmailKey', $Attributes, RandomString(8));
if ($RoleIDs)
$ConfirmedEmailRoles = $RoleIDs;
else
$ConfirmedEmailRoles = ConsolidateArrayValuesByKey($this->GetRoles($UserID), 'RoleID');
$Attributes['ConfirmedEmailRoles'] = $ConfirmedEmailRoles;
if ($RoleIDs)
$ConfirmedEmailRoles = $RoleIDs;
else
$ConfirmedEmailRoles = ConsolidateArrayValuesByKey($this->GetRoles($UserID), 'RoleID');
$Attributes['ConfirmedEmailRoles'] = $ConfirmedEmailRoles;
$RoleIDs = (array)C('Garden.Registration.ConfirmEmailRole');
$RoleIDs = (array)C('Garden.Registration.ConfirmEmailRole');
$SaveRoles = TRUE;
$Fields['Attributes'] = serialize($Attributes);
$SaveRoles = TRUE;
$Fields['Attributes'] = serialize($Attributes);
}
}
}

0 comments on commit c6fbc33

Please sign in to comment.
You can’t perform that action at this time.