Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9170667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:03:26+00:00 2026-06-17T16:03:26+00:00

I have a user profile view where users can edit their profile information. Everything

  • 0

I have a user profile view where users can edit their profile information. Everything below works great and the update is successful. However, when I logout of the account and login with a different user account, the update fails and returns an Access denied error. It isn’t until I refresh the page that I can edit the profile information again with the second account.

I know this case is very rare and a user would not normally be logging out of one account, logging in with another and trying to update their profile but I would like to better understand why this is happening. Is the client token not flushed when a user logs out or is there something else that’s being preserved that requires a complete reload of the page?

On client JS:

Template.user_profile_form.events({
    'click #submit_profile_btn': function(evt) {
        evt.preventDefault();
        var first_name = $('#profile_first_name').val()
            ,last_name = $('#profile_last_name').val()
            ,email = $('#profile_email').val()
            ,email_lower_case = email.toLowerCase()
            ,gravatar_hash = CryptoJS.MD5(email_lower_case)
        ;

        gravatar_hash = gravatar_hash.toString(CryptoJS.enc.Hex);

        // TODO need to create user sessions so that when you log out and log back in, you have a fresh session
        Meteor.users.update({_id: this.userId }, {
            $set: {
                profile: {
                    first_name: first_name,
                    last_name: last_name,
                    gravatar_hash: gravatar_hash
                }
            }
        }, function(error) {
            if (!error) {
                Session.set('profile_edit', 'success');
                Meteor.setTimeout(function() {
                    Session.set('profile_edit', null);
                }, 3000);
            } else {
                Session.set('profile_edit', 'error');
                Template.user_profile_form.error_message = function() {
                    return error.reason;
                };
            }
        });

        Meteor.call('changeEmail', email);
    }
});

The server JS:

Meteor.publish('list-all-users', function () {
    return Meteor.users.find({_id: this.userId }, {
        fields: {
            profile: 1,
            emails: 1
        }
    });
});

Meteor.methods({
    sendEmail: function(to, from, subject, text) {
        this.unblock();

        Email.send({
            to: to,
            from: from,
            subject: subject,
            text: text
        });
    },
    changeEmail: function(newEmail) {
        // TODO Need to validate that new e-mail does not already exist
        Meteor.users.update(Meteor.userId(), {
            $set: {
                emails: [{
                    address: newEmail,
                    verified: false
                }]
            }
        });
     }
});

The template:

<template name="user_profile_form">
    <h2>Update Profile</h2>
    <div id="profile-form">
        {{#if success}}
            <div class="alert alert-success">
                <strong>Profile updated!</strong> Your profile has been successfully updated.
            </div>
        {{/if}}
        {{#if error}}
            <div class="alert alert-error">
                <strong>Uh oh!</strong> Something went wrong and your profile was not updated. {{error_message}}.
            </div>
        {{/if}}
        <p>
            {{#each profile}}
            <input type="text" id="profile_first_name" placeholder="First Name" value="{{first_name}}">
            <input type="text" id="profile_last_name" placeholder="Last Name" value="{{last_name}}">
            {{/each}}
            <input type="email" id="profile_email" placeholder="Email" value="{{email_address}}">
        </p>
    </div>
    <div id="submit-btn">
        <input type="submit" id="submit_profile_btn" class="btn btn-primary">
    </div>
</template>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:03:27+00:00Added an answer on June 17, 2026 at 4:03 pm

    The Meteor logout function does almost nothing. It certainly does not tear down Session state or the rest of your app’s context. Your code must reset these variables during your app’s logout event. A manual refresh of the page causes the client side JavaScript to reload wiping out existing Session data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an and users can login and view their own profile with a
I have many user roles on my site. All users have profile information(custom fileds
I have a form where users get edit their personal information/settings and I'm trying
I have a view that shows user profile fields in a tabular format. There
I have a user profile page on my web app which has contact information.
On my iPhone app I am allowing the user to edit their profile picture.
I have a webform called UserProfile.aspx . After user logged-in, they can view and
So I have a user profile with a tab navigation in it: <div id=proftab>
I have a user and nested profile class as follows: class User < ActiveRecord::Base
User profile. I have some attributes that have only 2 or 3 options. For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.