Changeset 14

Show
Ignore:
Timestamp:
10/07/07 21:02:24 (11 months ago)
Author:
francois
Message:

added user profile

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/apps/frontend/modules/sfGuardAuth/actions/actions.class.php

    r6 r14  
    3131    $user->save(); 
    3232     
     33    $profile = new sfGuardUserProfile(); 
     34    $profile->setsfGuardUser($user); 
     35    $profile->setEmail($this->getRequestParameter('user_email')); 
     36    $profile->save(); 
     37     
    3338    $this->getUser()->signin($user, $this->getRequestParameter('rememeber', true)); 
    3439     
     
    4146  } 
    4247 
     48  public function handleErrorProfile() 
     49  { 
     50    $this->profile = $this->getUser()->getGuardUser()->getProfile(); 
     51    return sfView::SUCCESS; 
     52  } 
     53   
     54  public function executeProfile() 
     55  { 
     56    if($this->getRequest()->getMethod() == sfRequest::POST) 
     57    { 
     58      $user = $this->getUser(); 
     59      $userProfile = $user->getGuardUser()->getProfile(); 
     60      $userProfile->setFirstName($this->getRequestParameter('first_name')); 
     61      $userProfile->setLastName($this->getRequestParameter('last_name')); 
     62      $userProfile->setEmail($this->getRequestParameter('email')); 
     63      $userProfile->save(); 
     64       
     65      $this->setFlash('profile_saved', true); 
     66    } 
     67    $this->profile = $this->getUser()->getGuardUser()->getProfile(); 
     68  } 
    4369} 
  • trunk/apps/frontend/modules/sfGuardAuth/validate/createAccount.yml

    r6 r14  
     1fillin: 
     2  enabled: true 
     3 
    14methods: 
    25  post: [username, password, password2, user_email] 
     
    69    required:         true 
    710    required_msg:     Your username is required 
    8     validators:       [userValidator
     11    validators:       [userValidator, usernameValidator
    912 
    1013  password: 
     
    2932    unique_error: A user with this username already exists. Please choose another one. 
    3033 
     34usernameValidator: 
     35  class:          sfRegexValidator 
     36  param: 
     37    match:        false 
     38    pattern:      /[\s\.]+/ 
     39    match_error:  Usernames cannot have spaces or dots 
     40     
     41   
    3142passwordValidator: 
    3243  class:            sfCompareValidator 
  • trunk/apps/frontend/templates/layout.php

    r12 r14  
    2121    <li id="search_li"><?php echo link_to(__('Search'), 'sfLucene/search', 'id=search_link') ?></li> 
    2222    <?php if ($sf_user->isAuthenticated()): ?> 
    23       <li><?php echo __('Signed in as %user%', array('%user%' => $sf_user->getGuardUser()->getUsername() )) ?
    24       (<?php echo link_to(__('Sign out'), 'sfGuardAuth/signout') ?>)</li> 
     23      <li><?php echo link_to(__('Profile'), 'sfGuardAuth/profile') ?></li
     24      <li><?php echo link_to(__('Sign out'), 'sfGuardAuth/signout') ?></li> 
    2525    <?php else: ?> 
    2626      <li><?php echo link_to(__('Sign in'), 'sfGuardAuth/signin') ?></li> 
  • trunk/config/schema.yml

    r2 r14  
     1propel: 
     2  sf_guard_user_profile: 
     3    _attributes: { phpName: sfGuardUserProfile } 
     4    id: 
     5    user_id:     { type: integer, foreignTable: sf_guard_user, foreignReference: id, required: true, onDelete: cascade } 
     6    first_name:  varchar(100) 
     7    last_name:   varchar(100) 
     8    email:       varchar(255) 
  • trunk/web/css/forum.css

    r12 r14  
    7474} 
    7575 
    76 /* User login */ 
    77 form#signin 
     76form#signin, form#profile 
    7877{ 
    7978  width: 576px; 
     
    8382} 
    8483 
    85 form#signin label 
     84form#signin label, form#profile label 
    8685{ 
    8786  display: block; 
    8887  margin-top: 5px; 
    89 } 
    90  
    91 form#add_topic input#topic_submit 
    92 { 
    93   display: block; 
    9488} 
    9589 
     
    114108} 
    115109 
     110form#add_topic input#topic_submit 
     111{ 
     112  display: block; 
     113} 
     114 
    116115form.search-controls 
    117116{