|
|
@ -798,8 +798,6 @@ func CreateUser(u *User) (err error) { |
|
|
|
|
|
|
|
|
|
|
|
if _, err = sess.Insert(u); err != nil { |
|
|
|
if _, err = sess.Insert(u); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} else if err = os.MkdirAll(UserPath(u.Name), os.ModePerm); err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return sess.Commit() |
|
|
|
return sess.Commit() |
|
|
@ -898,7 +896,12 @@ func ChangeUserName(u *User, newUserName string) (err error) { |
|
|
|
return fmt.Errorf("Delete repository wiki local copy: %v", err) |
|
|
|
return fmt.Errorf("Delete repository wiki local copy: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return os.Rename(UserPath(u.Name), UserPath(newUserName)) |
|
|
|
// Do not fail if directory does not exist
|
|
|
|
|
|
|
|
if err = os.Rename(UserPath(u.Name), UserPath(newUserName)); err != nil && !os.IsNotExist(err) { |
|
|
|
|
|
|
|
return fmt.Errorf("Rename user directory: %v", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// checkDupEmail checks whether there are the same email with the user
|
|
|
|
// checkDupEmail checks whether there are the same email with the user
|
|
|
|